
{include file="Public/header"/}
<div class="clearfix clearfix20"></div>

<div class="container bankCardManagement">
    <div class="row">
        {include file="Public/readme"/}
        <div class="col-sm-9">


            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">银行卡管理</h3>
                </div>
            </div>
  <div id="myTabContentGrxx" class="tab-content">
  	<div role="tabpanel" class="tab-pane fade active in" id="tGrxx" aria-labelledby="tGrxx-tab">
          <div class="addAndDel">
                    {foreach name="bank" item="v"}
                
                      <div class="col-sm-3 text-left">
                                            <a href="#">
                                                 <!--{if condition="$v.AccountType==2"}-->
                            <!--<img src="/static/home/images/zfblogo.jpg"><br/>-->
                            <!--{/if}-->
                            <!--{if condition="$v.AccountType==1"}-->
                            <!--<img src="/static/home/images/yin.jpg">-->
                            <!--{/if}<br>-->
                            {$v.name}<br>{$v.bankName}：
                            {if condition="$v.AccountType==1"}<br />
                            {:substr($v.bankCard,0,10)}..... </a>
                            {else \}
                            {$v.bankCard} <br></a>
                            {/if}
                            <a class="delCard text-center" href="javascript:;" onclick="delCard({$v.id})">删除此银行卡</a>
                            </div>
                    
                    {/foreach}
                            <div class="col-sm-3 addCardWrap text-center" data-toggle="modal" data-target="#addCardWrap">
                                <!--<img src="\static\home/images/add.jpg">-->
                                <p>继续添加支付宝或银行卡</p>
                                <p style="margin-top:5px;color:red">推荐使用支付宝提现速度快</p>
                                <a class="addCard" href="#">添加支付宝或银行卡</a>
                            </div>
                                    <!--<a href="javascript:void(0);" class="test" data-toggle="modal" data-target=".regModalContract">期货交易商合同</a>-->
                </div>
        </div>
         </div>
         </div>
    </div>
</div>

<div class="modal fade" id="addCardWrap" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    添加支付宝或银行卡
                </h4>
            </div>
            <div class="modal-body">

                <form class="form-horizontal" method="post" action="/home/userbanks/addbank">
                    <div class="form-group">
                        <label for="cName" class="col-sm-3 control-label">开户名：</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" id="cName" placeholder="{$user.name}" disabled>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="cType" class="col-sm-3 control-label">帐户类型：</label>
                        <div class="col-sm-5">
                            <select class="form-control" id="cType">
                                <option value="0" selected>支付宝</option>
                                <option value="1">借记卡</option>
                            </select>
                        </div>
                        <div class="col-md-2 fontgreen" style="line-height:35px;">推荐支付宝</div>
                    </div>

                    <div class="cTypeWrapZfb">
                        <div class="form-group">
                            <label for="cNum" class="col-sm-3 control-label"><b
                                    class="redFont">*</b>&nbsp;支付宝账号：</label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" id="cNum" name="zfb" value="" placeholder="支付宝账号">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="cANum" class="col-sm-3 control-label"><b
                                    class="redFont">*</b>&nbsp;确定账号：</label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" id="cANum" name="zfb2" value="" placeholder="确定账号">
                            </div>
                        </div>
                    </div>


                    <div class="cTypeWrapYhk">

                        <div class="form-group cCardAddress">
                            <label for="cType" class="col-sm-3 control-label"><b
                                    class="redFont">*</b>&nbsp;选择银行：</label>
                            <div class="col-sm-7">
                                <div >
                                    <select class="form-control" name="bankName">
                                        <option  >请选择银行</option>
                                        <option  value="中国农业银行">中国农业银行</option>
                                        <option  value="中国工商银行">中国工商银行</option>
                                        <option  value="中国建设银行">中国建设银行</option>
                                        <option  value="中国邮政储蓄银行">中国邮政储蓄银行</option>
                                        <option  value="中国银行">中国银行</option>
                                        <option  value="招商银行">招商银行</option>
                                        <option  value="交通银行">交通银行</option>
                                        <option  value="浦发银行">浦发银行</option>
                                        <option  value="中国光大银行">中国光大银行</option>
                                        <option  value="中信银行">中信银行</option>
                                        <option  value="平安银行">平安银行</option>
                                        <option  value="中国民生银行">中国民生银行</option>
                                        <option  value="华夏银行">华夏银行</option>
                                        <option  value="广发银行">广发银行</option>
                                        <option  value="兴业银行">兴业银行</option>
                                        <option  value="上海银行">上海银行</option>
                                        <option  value="宁波银行">宁波银行</option>
                                        <option  value="杭州银行">杭州银行</option>
                                        <option  value="北京银行">北京银行</option>
                                        <option  value="温州银行">温州银行</option>
                                        <option  value="网商银行">网商银行</option>
                                        <option  value="中银富登村镇银行">中银富登村镇银行</option>
                                        <option  value="渤海银行">渤海银行</option>
                                        <option  value="包商银行">包商银行</option>
                                        <option  value="浙商银行">浙商银行</option>
                                        <option  value="浙江稠州商业银行">浙江稠州商业银行</option>
                                        <option  value="星展银行">星展银行</option>
                                        <option  value="恒丰银行">恒丰银行</option>
                                        <option  value="福建海峡银行">福建海峡银行</option>
                                        <option  value="东亚银行">东亚银行</option>
                                        <option  value="湖州银行">湖州银行</option>
                                        <option  value="金华银行">金华银行</option>
                                        <option  value="江苏银行">江苏银行</option>
                                        <option  value="嘉兴银行">嘉兴银行</option>
                                        <option  value="浙江民泰商业银行">浙江民泰商业银行</option>
                                        <option  value="宁波通商银行">宁波通商银行</option>
                                        <option  value="鄞州银行">鄞州银行</option>
                                        <option  value="宁波东海银行">宁波东海银行</option>
                                        <option  value="绍兴银行">绍兴银行</option>
                                        <option  value="天津滨海农村商业银行">天津滨海农村商业银行</option>
                                        <option  value="台州银行">台州银行</option>
                                        <option  value="银座村镇银行">银座村镇银行</option>
                                        <option  value="浙江省农村信用社联合社">浙江省农村信用社联合社</option>
                                        <option  value="浙江泰隆商业银行">浙江泰隆商业银行</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="form-group cCardAddress">
                            <label for="cType" class="col-sm-3 control-label"><b
                                    class="redFont">*</b>&nbsp;开户行所在地：</label>
                            <div class="col-sm-7">
                                <div data-toggle="distpicker">
                                    <select class="form-control" id="sheng" name="sheng"></select>
                                    <select class="form-control" id="shi" name="shi" ></select>
                                    <select class="form-control" id="qu" name="qu" ></select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="cANum" class="col-sm-3 control-label"><b
                                    class="redFont">*</b>&nbsp;开户行网点：</label>
                            <div class="col-sm-5">
                                <input type="text" name="bankTypes" value="" class="form-control" id="cANum" placeholder="开户行网点">
                            </div>
                            <div class="col-sm-2 pull-left addCardWdcx"><a
                                    href="http://www.cardbaobao.com/bank/index.asp" target="_blank">网点查询</a></div>
                        </div>
                        <div class="form-group">
                            <label for="cANum" class="col-sm-3 control-label"><b
                                    class="redFont">*</b>&nbsp;银行卡号：</label>
                            <div class="col-sm-5">
                                <input type="text" name="bankCard" value="" class="form-control" id="cANum" placeholder="银行卡号">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="cANum" class="col-sm-3 control-label"><b
                                    class="redFont">*</b>&nbsp;确认卡号：</label>
                            <div class="col-sm-5">
                                <input type="text" name="bankCards" value="" class="form-control" id="cANum" placeholder="确认卡号">
                            </div>
                        </div>
                        <input type="hidden" name="codess" value="1351">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="submit">确认添加</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>


<br /><br /><br /><br /><br /><br /><br />
<!--footer-->
{include file="Public/footer"/}
<!--footer-->


<!--<script src="/static/home/js/area/personal_head_menu.js"></script>-->
<script src="/static/home/js/area/distpicker.data.js"></script>
<script src="/static/home/js/area/distpicker.js"></script>
<script src="/static/home/js/area/main.js"></script>
</body>
</html>
<script> $("#collapseOne").find(".list-group").find("li").eq(5).addClass("active");</script>

<script>

    //删除账户
    function delCard(id) {
        if(confirm("删除是不可恢复的，你确认要删除吗？")){
            $.post('/home/bankCards/delbank',{id:id},function(data){
                if(data['msg']!='success'){
                    alert(data['msg']);
                }else{
                    window.location.reload();
                }
            });
        }
    }
    //cType


    $(".cTypeWrapYhk").addClass("hide");
    $("#cType").change(function(){
        var cType=$("#cType").val();
        if(cType == 0){
            $(".cTypeWrapYhk").addClass("hide");
            $(".cTypeWrapZfb").removeClass("hide");
        }else{
            $(".cTypeWrapZfb").addClass("hide");
            $(".cTypeWrapYhk").removeClass("hide");
        }
    });

    $(function(){
        $("#submit").click(function(){
            var option = $('#cType').val();
            pattern = new RegExp("[`~!#$^&*()=|{}':;',\\[\\]<>/?~！#￥……&*（）——|{}【】‘；：”“'。，、？《》]");
            if(option==0){
                //支付宝添加
                var zfb = $("input[name='zfb']").val();
                var zfb2 = $("input[name='zfb2']").val();
                if(pattern.test(zfb)){
                    alert('不能使用特殊字符');
                }else{
                    if(zfb==zfb2){
                        $.post('/home/bankCards/addbank',{zfb:zfb,zfb2:zfb2,option:option,codes:{:session('codes')}},function(data){
                            if(data['msg'] == 'success'){
                                alert('添加成功');
                                window.location.reload();
                            }else{
                                alert(data['msg']);
                            }
                        });
                    }else{
                        alert('两次账号不一致');
                    }

                }
            }else if(option ==1){
                var bankCard = $("input[name='bankCard']").val();
                var bankCards = $("input[name='bankCards']").val();
                var bankTypes = $("input[name='bankTypes']").val();
                var bankName = $("select[name='bankName']").val();
                var sheng = $("#sheng").val();
                var shi = $("#shi").val();
                var qu = $("#qu").val();
                $.post('/home/bankcards/addbank',{bankCard:bankCard,bankCards:bankCards,bankTypes:bankTypes,bankName:bankName,sheng:sheng,shi:shi,qu:qu,option:option,codes:{:session('codes')}},function(data){
//                    alert(data);
//                    console.log(data);
                    if(data['msg'] == 'success'){
                        alert('添加成功');
                        window.location.reload();
                    }else{
                        alert(data['msg']);
                    }
                })
            }

        })
    })

</script>